package com.gel.shortLink.admin.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gel.shortLink.admin.convention.result.Result;
import com.gel.shortLink.admin.remote.dto.req.ShortLinkCreateReqDTO;
import com.gel.shortLink.admin.remote.dto.req.ShortLinkPageReqDTO;
import com.gel.shortLink.admin.remote.dto.resp.ShortLinkCreateRespDTO;
import com.gel.shortLink.admin.remote.dto.resp.ShortLinkGroupCountQueryRespDTO;
import com.gel.shortLink.admin.remote.dto.resp.ShortLinkPageRespDTO;
import com.gel.shortLink.admin.remote.service.ShortLinkRemoteService;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/short-link/admin/link")
public class ShortLinkRemoteController {
    ShortLinkRemoteService shortLinkRemoteService = new ShortLinkRemoteService(){};
    /*创建短链接*/
    @PostMapping("/create")
    public Result<ShortLinkCreateRespDTO> createShortLink(@RequestBody ShortLinkCreateReqDTO requestParam) {
       return shortLinkRemoteService.createShortLink(requestParam);
    }

    /*分页查询短链接*/
    @GetMapping("/page")
    public Result<IPage<ShortLinkPageRespDTO>> pageShortLink(@RequestBody ShortLinkPageReqDTO requestParam){


        return shortLinkRemoteService.pageShortLink(requestParam);

    }
    /*查询分组短链接数量*/
    @GetMapping("/list")
    public Result<List<ShortLinkGroupCountQueryRespDTO>> listGroupShortLinkCount(@RequestParam("requestParam") List<String> requestParam) {
        return shortLinkRemoteService.listGroupShortLinkCount(requestParam);

    }

}
